package cn.lccabc.attend.controller;

import cn.lccabc.attend.entity.Attend;
import cn.lccabc.attend.service.AttendService;
import cn.lccabc.attend.vo.QueryCondition;
import cn.lccabc.common.page.PageQueryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by L on 2018/4/12.
 */
@Controller
@RequestMapping(value = "attend")
public class AttendController {

    @Autowired
    private AttendService attendService;

    @RequestMapping(value = "sign")
    @ResponseBody
    public String signAttend(@RequestBody Attend attend) throws Exception {
        attendService.signAttend(attend);
        return "success";
    }

    /**
     * 考勤数据分页查询
     * @param condition
     * @return
     */
    @RequestMapping(value = "attends")
    @ResponseBody
    public PageQueryBean listAttend(QueryCondition condition){
        PageQueryBean result = attendService.listAttend(condition);
        return result;
    }
}
